package org.zy.core;

import java.util.Arrays;

public class Message {

    /**
     * 心跳
     */
    public static final byte TYPE_HEARTBEAT = 0X00;

    /**
     * 连接成功
     */
    public static final byte TYPE_CONNECT = 0X01;

    /**
     * 数据传输
     */
    public static final byte TYPE_TRANSFER = 0X02;

    /**
     * 连接断开
     */
    public static final byte TYPE_DISCONNECT = 0X09;

    /**
     * 数据类型
     */
    private byte type;

    /**
     * 消息传输数据
     */
    private byte[] data;

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public String toString() {
        return "Message [type=" + type + ", data=" + Arrays.toString(data) + "]";
    }

    public Message() {
    }

    public Message(byte type) {
        this.type = type;
    }

    public Message(byte type, byte[] data) {
        this.type = type;
        this.data = data;
    }
}